<?php
namespace Admin\Controller;
use Think\Controller;
class CommonController extends Controller {
	public function _initialize(){

		$rule =  MODULE_NAME.'/'.CONTROLLER_NAME.'/'.ACTION_NAME;
		if(CONTROLLER_NAME=='Login'){
			return;
		}
		if(isset($_SESSION['admin_uid'])){

			$uid = $_SESSION['admin_uid'];

			$auth = new \Think\Auth();

			// if(!$auth->check($rule,$uid)){
			// 	echo "你没有权限";exit;
			// }

		}else{
			// echo "你还没有登录";
		}
	}

	public function log($content)
	{
		$data['username']=$_SESSION['username'];
		$data['create_time']=time();
		$data['ip']=get_client_ip();
		$data['content']=$content;
		M('log')->add($data);
	}
}